﻿<%@ Page Title="Manage Custom Behavior Types" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="ManageCustomBehaviorTypes.aspx.cs" Inherits="NIntegrate.Configuration.UI.ManageCustomBehaviorTypes" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>Manage Custom Behavior Types</h2>
    <div class="bottomhyperlink"><img alt="Add new behavior type" src="Images/plus.gif" /><asp:LinkButton 
            ID="btnShowAddNewPanel" runat="server" Text="Add new behavior type" 
            onclick="btnShowAddNewPanel_Click"></asp:LinkButton></div>
    <br />
    <asp:GridView CssClass="gridview"
        ID="gvBehaviorTypes" runat="server" 
        DataSourceID="dsCustomBehaviorTypes"
        DataKeyNames="BehaviorType_id"
        AllowSorting="true"
        AutoGenerateDeleteButton="true"
        AutoGenerateColumns="false"
        AutoGenerateEditButton="true" onrowcommand="gvBehaviorTypes_RowCommand">
        <Columns>
            <asp:TemplateField HeaderText="ExtensionName" SortExpression="BehaviorTypeExtensionName">
                <ItemTemplate>
                    <%#Eval("BehaviorTypeExtensionName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="tbBehaviorTypeExtensionName" runat="server" MaxLength="100" Text='<%#Bind("BehaviorTypeExtensionName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="tbBehaviorTypeExtensionNameRequired" runat="server"
                        ControlToValidate="tbBehaviorTypeExtensionName" EnableClientScript="false"
                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="FriendlyName" SortExpression="BehaviorTypeFriendlyName">
                <ItemTemplate>
                    <%#Eval("BehaviorTypeFriendlyName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="tbBehaviorTypeFriendlyName" runat="server" MaxLength="100" Text='<%#Bind("BehaviorTypeFriendlyName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="tbBehaviorTypeFriendlyNameRequired" runat="server"
                        ControlToValidate="tbBehaviorTypeFriendlyName" EnableClientScript="false"
                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ClassName" SortExpression="BehaviorTypeClassName">
                <ItemTemplate>
                    <%#Eval("BehaviorTypeClassName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="tbBehaviorTypeClassName" runat="server" Text='<%#Bind("BehaviorTypeClassName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="tbBehaviorTypeClassNameRequired" runat="server"
                        ControlToValidate="tbBehaviorTypeClassName" EnableClientScript="false"
                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ConfigurationElementClassName" SortExpression="BehaviorConfigurationElementTypeClassName">
                <ItemTemplate>
                    <%#Eval("BehaviorConfigurationElementTypeClassName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="tbBehaviorConfigurationElementTypeClassName" runat="server" Text='<%#Bind("BehaviorConfigurationElementTypeClassName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="tbBehaviorConfigurationElementTypeClassNameRequired" runat="server"
                        ControlToValidate="tbBehaviorConfigurationElementTypeClassName" EnableClientScript="false"
                        ErrorMessage="Required"></asp:RequiredFieldValidator>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Category" SortExpression="BehaviorCategory_id">
                <ItemTemplate>
                    <asp:DropDownList ID="ddlBehaviorCategories" runat="server" SelectedValue='<%# Bind("BehaviorCategory_id") %>' Enabled="false">
                        <asp:ListItem Text="Service" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Endpoint" Value="2"></asp:ListItem>
                    </asp:DropDownList>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlBehaviorCategories" runat="server" SelectedValue='<%# Bind("BehaviorCategory_id") %>'>
                        <asp:ListItem Text="Service" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Endpoint" Value="2"></asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
        <SelectedRowStyle BackColor="LightYellow" />
    </asp:GridView>
    <asp:Panel ID="panelBottom" runat="server" CssClass="panelBottom">
        <asp:DetailsView ID="dvAddBehaviorType" runat="server" Visible="false"
            DataSourceID="dsCustomBehaviorTypes" DefaultMode="Insert"
            AutoGenerateRows="false"
            AutoGenerateInsertButton="true"
            CssClass="detailstable" onitemcommand="dvAddBehaviorType_ItemCommand" 
            oniteminserted="dvAddBehaviorType_ItemInserted">
            <Fields>
                <asp:TemplateField HeaderText="ExtensionName">
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbBehaviorTypeExtensionName" runat="server" MaxLength="100" Text='<%#Bind("BehaviorTypeExtensionName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="tbBehaviorTypeExtensionNameRequired" runat="server"
                            ControlToValidate="tbBehaviorTypeExtensionName" EnableClientScript="false"
                            ErrorMessage="Required"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="FriendlyName">
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbBehaviorTypeFriendlyName" runat="server" MaxLength="100" Text='<%#Bind("BehaviorTypeFriendlyName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="tbBehaviorTypeFriendlyNameRequired" runat="server"
                            ControlToValidate="tbBehaviorTypeFriendlyName" EnableClientScript="false"
                            ErrorMessage="Required"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ClassName">
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbBehaviorTypeClassName" runat="server" Text='<%#Bind("BehaviorTypeClassName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="tbBehaviorTypeClassNameRequired" runat="server"
                            ControlToValidate="tbBehaviorTypeClassName" EnableClientScript="false"
                            ErrorMessage="Required"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ConfigurationElementClassName">
                    <InsertItemTemplate>
                        <asp:TextBox ID="tbBehaviorConfigurationElementTypeClassName" runat="server" Text='<%#Bind("BehaviorConfigurationElementTypeClassName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="tbBehaviorConfigurationElementTypeClassNameRequired" runat="server"
                            ControlToValidate="tbBehaviorConfigurationElementTypeClassName" EnableClientScript="false"
                            ErrorMessage="Required"></asp:RequiredFieldValidator>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Category">
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlBehaviorCategories" runat="server" SelectedValue='<%# Bind("BehaviorCategory_id") %>'>
                            <asp:ListItem Text="Service" Value="1"></asp:ListItem>
                            <asp:ListItem Text="Endpoint" Value="2"></asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                </asp:TemplateField>
            </Fields>
        </asp:DetailsView>      
    </asp:Panel>
    <ni:QueryDataSource ID="dsCustomBehaviorTypes" runat="server" UseLocalQueryService="true">
    </ni:QueryDataSource>
</asp:Content>
